<style>
    .privilege_container{
        height: 100px;
        padding:15px;
        color: #666666;
    }
    .privilege_container .col-md-1{
        height: 50px;
        color: #34847e;
    }
    .privilege_container .btn-primary{
            color:#fff;
            background-color: #2cb5ac;
            font-size: 12px;
    }
    .privilege_container .form-group div{
		padding-left: 0px;
	}
</style>
<div class="privilege_container">
    <div class="col-md-1">
        <!-- Button trigger modal -->
        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
            添加
        </button>
    </div>
    <!-- Modal -->
    <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header"  style="border: none;">
            <h4 class="modal-title" id="exampleModalLabel" style="float: left;">添加权限</h4>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
            </div>
            <div class="modal-body">
                <form class="form-horizontal">
                <div class="form-group">
                    <label for="inputEmail3" class="col-sm-2 control-label"><span style="color: red;">*</span> 名称</label>
                    <div class="col-sm-10">
                    <input type="email" class="form-control" id="inputEmail3">
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputPassword3" class="col-sm-2 control-label"><span style="color: red;">*</span> 路径</label>
                    <div class="col-sm-10">
                    <input type="text" class="form-control" id="inputPassword3">
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputPassword3" class="col-sm-2 control-label"><span style="color: red;">*</span> 类型</label>
                    <div class="col-sm-10">
                    <input type="password" class="form-control" id="inputPassword3">
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputPassword3" class="col-sm-2 control-label">父权限</label>
                    <div class="col-sm-10">
                    <input type="password" class="form-control" id="inputPassword3">
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputPassword3" class="col-sm-2 control-label">序号</label>
                    <div class="col-sm-10">
                    <input type="text" class="form-control" id="inputPassword3">
                    </div>
                </div>
                <div class="form-group">
                    <label for="inputPassword3" class="col-sm-2 control-label">描述</label>
                    <div class="col-sm-10">
                        <textarea name="introduce" id="inputPassword3" class="form-control" rows="2" style="resize: vertical;" ></textarea>
                    </div>
                </div>
                </form>
            </div>
            <div class="modal-footer"  style="border-top: none;">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
            <button type="button" class="btn btn-primary" id="save">确定</button>
            </div>
        </div>
        </div>
    </div>
    <div class="row">
        <table class="table table-hover">
           <thead>
               <th>名称</th>
               <th>路径</th>
               <th>类型</th>
               <th>序号</th>
               <th>图标</th>
               <th>状态</th>
               <th>操作</th>
           </thead>
           <tbody>

           </tbody>
    </table>
</div>

<script type="text/javascript">
    //1.获取所有权限管理信息
    var Url="http://39.96.74.136:7788/privilege/findAll";
    $.ajax({
        url:Url,
        type:'get',
        headers:{
            "Authorization":sessionStorage.getItem("token")
        },
        success:function(data){
            console.log(data);
            if(data.status==200){
                var privilege=data.data;
                privilege.forEach((item)=>{
                    $(".privilege_container tbody").append(`<tr>
                        <td>`+item.name+`</td>    
                        <td>`+item.route+`</td>    
                        <td>`+item.type+`</td>    
                        <td>`+item.id+`</td>    
                        <td>`+item.icon+`</td>    
                        <td>`+item.description+`</td> 
                        <td>
                            <span>移除</span>    
                            <span>修改</span>     
                        </td>   
                    </tr>`)
                })
            }
        }
    })
</script>
